﻿using System;

namespace FluentPS.Attributes
{
    [AttributeUsage(AttributeTargets.Property)]
    public class PSLookupFieldAttribute : PSCustomFieldAttribute
    {
        public PSLookupFieldAttribute(string fieldUid)
            : base(fieldUid)
        {
            Sort = true;
            MaxStructLevel = 1;
            SelectLeafsOnly = false;
        }

        public PSLookupFieldAttribute(string fieldUid, string fieldName)
            : base(fieldUid, fieldName)
        {
            Sort = true;
            MaxStructLevel = 1;
        }
        public PSLookupFieldAttribute(string fieldUid, string fieldName, bool isRequired)
            : base(fieldUid, fieldName, isRequired)
        {
            Sort = true;
            MaxStructLevel = 1;
        }

        public PSLookupFieldAttribute(string fieldUid, string lookupTableName, string lookupTableUid)
            : base(fieldUid)
        {
            Sort = true;
            LookupTableName = lookupTableName;
            LookupTableUid = new Guid(lookupTableUid);
            MaxStructLevel = 1;
        }

        public string LookupTableName { get; set; }
        public Guid LookupTableUid { get; set; }
        public bool IsPredefinedLookupTable { get; set; }
        public bool Sort { get; set; }
        public int MaxStructLevel { get; set; }
        public bool SelectLeafsOnly { get; set; }
        public object DefaultValue { get; set; }
    }
}
